<style>

    label.inline{
        display: inline;
        vertical-align: 1px;
    }
    .block{
        border-bottom: 1px dashed #ddd;
        padding: 10px;
        display: block;
    }
    .block_heading{
        margin-bottom: 15px;
        font-weight: bold;
        text-decoration: underline;
    }
    /*Table*/ 
    div.copy{
        clear: both;
        padding: 5px 0px;
    }
    div.r .num{
        width: 50px;
    }
    div.item_group{
        float: left;
        width: 80px;
    }
    div.item_name{
        float: left;
        width: 130px;
    }
    div.item_gender{
        float: left;
        width: 80px;
    }
    div.item_color{
        float: left;
        width: 110px;
    }
    div.item_more_info{
        float: left;
        width: 160px;
    }
    div.laundry{
        float: left;
        width: 95px;
    }
    div.dry{
        float: left;
        width: 95px;
    }
    div.iron{
        float: left;
        width: 75px;
    }
    div.laundry_dry{
        float: left;
        width: 75px;
    }
    span.delete{
        cursor: pointer; 
        vertical-align: -4px;
        padding-right: 6px;
    }
    div.laundry_dry, span.checkbox_laundry_dry, div.iron{
        display: none;
    }
    .price_small{
        font-size: 12px;
        text-align: center;
        margin-left: 10px;
    }
    a.da-button:hover{
        text-decoration: none;
    }

    table.da-table.table-bill{
        margin: 10px 0px;
        border-top: 1px solid #ccc;
        border-bottom: 1px solid #ccc;
    }
    .table-bill th, 
    .table-bill td{
        padding: 4px 10px
    } 
</style>
<div class="grid_4">       
    <div class="da-panel">
        <div class="da-panel-header">
            <span class="da-panel-title">
                <img alt="" src="<?php echo $this->themeUrl; ?>/files/theme/images/icons/color/monitor.png">
                Cập nhật đơn hàng: <?php echo $model->code; ?>
            </span>
        </div>

        <div id="da-ex-tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
            <?php $this->renderPartial('_tabs', compact('model'))?>
            <div>
                <?php $this->widget('admin.components.widgets.AlertWidget');?>

                <?php if(in_array($model->status, array('CANCEL', 'COMPLETED'))):?>
                    <?php if($model->status == 'COMPLETED'):?>
                        <div class="da-message success">Đơn hàng <?php echo $model->code?> đã hoàn thành</div>
                    <?php else:?>
                        <div class="da-message warning">Đơn hàng <?php echo $model->code?> đã bị hủy bỏ</div>
                    <?php endif?>  
                <?php else:?>
                
                <?php $form=$this->beginWidget('CActiveForm', array(
                        'id'    =>  'bill-form',
                        'enableClientValidation'=>true,
                        'clientOptions'=>array(
                            'validateOnSubmit'=>true,
                        ),
                        'enableAjaxValidation'=>true,
                        'htmlOptions'=>array(
                            'class' => 'da-form'
                        ),
                    )); ?>


                <table class="da-table">
                    <tr class="even">
                        <td>
                            <div class="block_heading">
                                <span><?php echo Bill::model()->getAttributeLabel('status_pay')?></span>
                            </div>
                            <?php echo $form->dropDownList($model, 'status_pay', $model->statusPayData, array('style' => 'width: 100%', 'options' => Bill::model()->getStatusOptionsData(Bill::model()->statusPayData)));?>
                        </td>

                        <td>
                            <div class="block_heading">
                                <span><?php echo Bill::model()->getAttributeLabel('status_do')?></span>
                            </div>
                            <?php echo $form->dropDownList($model, 'status_do', $model->statusDoData, array('style' => 'width: 100%', 'options' => Bill::model()->getStatusOptionsData(Bill::model()->statusDoData)));?>

                        </td>

                        <td>
                            <div class="block_heading">
                                <span><?php echo Bill::model()->getAttributeLabel('status_return')?></span>
                            </div>
                            <?php echo $form->dropDownList($model, 'status_return', $model->statusReturnData, array('style' => 'width: 100%', 'options' => Bill::model()->getStatusOptionsData(Bill::model()->statusReturnData)));?>

                        </td>

                        <td>
                            <div class="block_heading">
                                <span><?php echo Bill::model()->getAttributeLabel('status')?></span>
                            </div>
                            <?php echo $form->dropDownList($model, 'status', $model->statusData, array('style' => 'width: 100%', 'options' => Bill::model()->getStatusOptionsData(Bill::model()->statusData)));?>

                        </td>
                        <td>
                            <div class="block_heading">
                                <span>Gửi tin nhắn</span>
                            </div>
                            <?php echo $form->checkBox($model, 'send_sms');?>

                        </td>
                    </tr>
                    <tr class="even">
                        <td colspan="4"><?php echo $form->error($model,'status'); ?></td>
                    </tr>
                </table>


                <div style="padding: 10px; text-align: center;">   
                    <button type="submit" class="da-button blue">
                        <i class="icon-ok icon-white"></i> Cập nhật đơn hàng
                    </button>
                </div>

                <?php $this->endWidget();?>
                
                <?php endif?>
            </div>

            <hr>
            <div class="block" style="text-decoration: underline;">
                <i class="icon-share"></i> <b>Thông tin đơn hàng: <?php echo $model->code; ?></b>
            </div>
            <br>

            <?php echo $this->renderPartial('_view_content',array('model'=>$model, 'info'=>$info)); ?>

            <?php if($this->manager && $this->manager->isAdmin):?>
                <hr>
                <div class="block" style="text-decoration: underline;">
                    <b>Update Logs</b>
                </div>

                <table class="da-table table-bill">
                    <thead>
                        <tr>
                            <th>Thời gian</th>
                            <th>Trạng thái thanh toán</th>
                            <th>Trạng thái giặt</th>
                            <th>Trạng thái trả đồ</th>
                            <th>Trạng thái đơn hàng</th>
                            <th>Người thay đổi</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach($model->managerUpdateBills as $mub):?>
                            <tr>
                                <td><?php echo $mub->createdTime?></td>
                                <td>
                                    <span class="label bg-<?php echo Bill::model()->getLabelStyle($mub->status_pay)?>">
                                        <?php echo Bill::model()->getStatusPayLabel($mub->status_pay)?>
                                    </span>
                                </td>
                                <td>
                                    <span class="label bg-<?php echo Bill::model()->getLabelStyle($mub->status_do)?>">
                                        <?php echo Bill::model()->getStatusDoLabel($mub->status_do)?>
                                    </span>
                                </td>
                                <td>
                                    <span class="label bg-<?php echo Bill::model()->getLabelStyle($mub->status_return)?>">
                                        <?php echo Bill::model()->getStatusReturnLabel($mub->status_return)?>
                                    </span>
                                </td>
                                <td>
                                    <span class="label bg-<?php echo Bill::model()->getLabelStyle($mub->status)?>">
                                        <?php echo Bill::model()->getStatusLabel($mub->status)?>
                                    </span>
                                </td>
                                <td><?php echo $mub->manager->name?> (<?php echo $mub->manager->phone?>)</td>
                            </tr>
                            <?php endforeach?>
                    </tbody>
                </table>
                <?php endif?>

        </div>

    </div>
</div>       

